package com.daihou.BCJ.userFeature;

import com.daihou.config.TheAuth;
import com.daihou.model.ceres.In_UserFeature;
import com.daihou.utils.ConfigUserFeature;
import com.daihou.utils.DHHttpUtil;
import org.testng.Assert;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

public class ufListQuery {
	private String url;
	Map<String, String> headers;
	@BeforeTest(description = "测试准备工作,获取Authorization对象")
	public void beforeTest() throws IOException {
		url= ConfigUserFeature.getUrl(In_UserFeature.LISTQUERY.toString());
		headers=new HashMap<>();
		//设置请求头中的Authorization
		headers.put("Authorization", TheAuth.getAuth());
		//需要admin权限
		headers.put("X-UserName", "admin");
	}

	@Test(description = "人员特征列表查询")
	public void s1() throws IOException {
		String strBody = "{\"pageNum\":1,\"pageSize\":20,\"order\":null,\"code\":\"admin\",\"name\":\"\",\"orgCode\":\"\",\"orgName\":\"\",\"realName\":\"\",\"startHiredate\":\"\",\"endHiredate\":\"\",\"startLeavedate\":\"\",\"endLeavedate\":\"\",\"jobNumber\":\"\",\"organ\":\"\",\"gender\":\"\",\"provinceCode\":\"\",\"cityCode\":\"\",\"rankOrder\":\"\",\"rankLevel\":\"\",\"seniority\":\"\"}";
		String result = DHHttpUtil.post_with_String(url,strBody,headers).toJSONString();
		System.out.println("================ "+result);
		Assert.assertTrue(result.contains("\"message\":\"操作成功\",\"status\":\"0\""));
	}
}